home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / System / Sample JGNE⁄cdev 1.2.1 / (MyJGNE.π) / MyEvtHandler.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-04  |  1.7 KB  |  51 lines  |  [TEXT/KAHL]

  1. /*
  2.     MyEvtHandler.c
  3.  
  4.     Written by Ken Worley, 06/03/94, using Symantec Think C 7.0.
  5.     Copyright 1994.
  6.     AOL KNEworley
  7.     internet KNEworley@aol.com
  8.     
  9.     Feel free to use this code in a project of your own, but give me proper
  10.     credit in your documentation or about box.  Feel free to distribute this
  11.     code in its entirety to anyone, but never do so without the copyright
  12.     notice above nor without its accompanying files.  This code is NOT in
  13.     the public domain.  Use of this code in a commercial product requires my
  14.     permission.
  15.     
  16.     This code is called by the JGNE filter code to examine events and to
  17.     take action on intercepted events.  MyEvtHandler returns nonzero if the event
  18.     should be intercepted (returned to the calling application as a NULL event),
  19.     or false if the event should be returned to the app as usual.  MyEvtHandler
  20.     gets called for EVERY event sent to any application.
  21. */
  22.  
  23.  
  24. #include <Processes.h>
  25.  
  26. /*************************** FUNCTIONS *****************************/
  27.  
  28. // The MyEvtHandler routine gets called to examine every event passed to
  29. // any application.  Currently, it only checks to see if the event is
  30. // a mouseDown event and if the same modifier keys are down that are set
  31. // in the control panel.  If so, it plays a system beep and indicates
  32. // that the event should be intercepted (by returning nonzero).  Otherwise,
  33. // the routine simply returns zero to indicate the event should be handled
  34. // by the system as usual (pass it to the application).
  35. //
  36. Boolean    MyEvtHandler( EventRecord *event )
  37. {
  38.     Boolean    retValue;
  39.     
  40.     if ( ( event->what == mouseDown ) &&
  41.         ( myData.CPmodifiers == event->modifiers ) )
  42.     {
  43.         SysBeep( 5 );
  44.         retValue = true;
  45.     }
  46.     else
  47.         retValue = false;
  48.     
  49.     return retValue;
  50. }
  51.